package com.wowangz.cms.dailyoperation.menuauthoritymanage.service;

import java.util.HashMap;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.wowangz.cms.dailyoperation.menuauthoritymanage.pojo.MenuAuthorityManage;
import com.wowangz.cms.syscore.exception.ServiceException;
import com.wowangz.cms.syscore.service.BaseService;

public class MenuAuthorityManageService extends BaseService {

	private Logger logger = LoggerFactory.getLogger(MenuAuthorityManageService.class);
	
	/**
	 * 分页查询总条数
	 * 
	 * @param map
	 * @return
	 */
	public long findResultCount(HashMap<String, Object> map) throws ServiceException {
		Long countNum = this.getSqlSession().selectOne("MenuAuthorityManage.queryMenuAuthorityManageCount", map);
		return countNum;
	}

	/**
	 * 查询记录集合
	 * 
	 * @param map
	 * @return
	 */
	public List<MenuAuthorityManage> findResultList(HashMap<String, Object> map) throws ServiceException {
		List<MenuAuthorityManage> list = this.getSqlSession().selectList("MenuAuthorityManage.queryMenuAuthorityManagePage", map);
		return list;
	}
	
	/**
	 * 新增
	 * @param charge
	 * @throws ServiceException
	 */
	public void insertMenuAuthorityManage(MenuAuthorityManage menuAuthorityManage) throws ServiceException{
		this.getSqlSession().insert("MenuAuthorityManage.insertMenuAuthorityManage",menuAuthorityManage);
	}
	
	/**
	 * 根据ID查数据
	 * @param id
	 * @return
	 * @throws ServiceException
	 */
	public MenuAuthorityManage queryMenuAuthorityManageByID(HashMap<String,Object> hashMap) throws ServiceException{
		MenuAuthorityManage menuAuthorityManage = (MenuAuthorityManage)this.getSqlSession().selectOne("MenuAuthorityManage.queryMenuAuthorityManageByID",hashMap);
		return menuAuthorityManage;
	}
	
	
	/**
	 *  修改商户收费管理表
	 * @param charge
	 * @throws ServiceException
	 */
	public void updateMenuAuthorityManage(MenuAuthorityManage menuAuthorityManage) throws ServiceException {
		this.getSqlSession().update("MenuAuthorityManage.updateMenuAuthorityManage", menuAuthorityManage);
	}
	
	/**
	 * 删除商户收费临时表
	 * @param id
	 * @throws ServiceException
	 */
	public void deleteMenuAuthorityManage(Long id) throws ServiceException{
		this.getSqlSession().delete("MenuAuthorityManage.deleteMenuAuthorityManage",id);
	}
	
	public boolean validattionMenuAuthorityManage(MenuAuthorityManage menuAuthorityManage) throws ServiceException{
		MenuAuthorityManage menuAuthorityManages = (MenuAuthorityManage)this.getSqlSession().selectOne("MenuAuthorityManage.validattionMenuAuthorityManage", menuAuthorityManage);
		if(menuAuthorityManages !=null){
			return true;
		}else{
			return false;
		}
	}
}
